package com.baizhi.product.config;

import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class OSSConfig {
    // Endpoint以北京为例。
    public  static String ENDPOINT = "oss-cn-beijing.aliyuncs.com";
    @Bean
    public OSS ossClient(){
        // 阿里云主账号AccessKey拥有所有API的访问权限，风险很高。强烈建议您创建并使用RAM账号进行API访问或日常运维，请登录RAM控制台创建RAM账号。
        String accessKeyId = "LTAI5tMSXeDFsJaXGYvLSHAD";
        String accessKeySecret = "sjfDVNPLvphxH2gQqJorR8kBs7TXz3";
        // 创建OSSClient实例。
        OSS ossClient = new OSSClientBuilder().build("https://"+ENDPOINT, accessKeyId, accessKeySecret);
        return ossClient;
    }
}
